package org.rsbot.event.impl;

import java.awt.Graphics;
import org.rsbot.event.listeners.TextPaintListener;
import org.rsbot.util.StringUtil;

public class TFPS
  implements TextPaintListener
{
  private static final int LEN = 2;
  private final int[] frameCount = new int[2];

  private int lastIdx = 0;

  public int drawLine(Graphics paramGraphics, int paramInt) {
    int i = (int)(System.currentTimeMillis() / 1000L);

    int j = (i - 1) % 2;
    StringUtil.drawLine(paramGraphics, paramInt++, String.format("%2d fps", new Object[] { Integer.valueOf(this.frameCount[j]) }));

    int k = i % 2;
    if (this.lastIdx != k) {
      this.lastIdx = k;
      this.frameCount[k] = 1;
    } else {
      this.frameCount[k] += 1;
    }
    return paramInt;
  }
}